home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HPAVC
/
HPAVC CD-ROM.iso
/
PWAULTP3.ZIP
/
PWAPRGMS.A02
/
PWA95
/
PWAEQU11.ZIP
/
EQU.PPS
< prev
next >
Wrap
Text File
|
1995-11-15
|
14KB
|
430 lines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Enhanced Quick Uploader v1.1
; Written by Drew [PWA]
; Last updated 11-15-95
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; function & procedure prototypes, err, declarations
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
declare procedure Initialize()
declare procedure CheckU()
declare procedure CheckIndicate()
declare function AskYesNo(string pr_string) boolean
declare procedure PrintSelected(int curcmd, int col1, int col2)
declare function GenerateDummyFilename() string
declare procedure StuffKeyboard(string filename)
declare procedure IndicateBlindUpload()
declare procedure ShowRules()
declare function DoPrivateUpload() boolean
declare function GetFilename() string
declare procedure GetDescription()
declare procedure SendMessage(string filename)
declare procedure CheckAttach()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; some variables just have to be declared globally
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
string equ_cfg ; config file for EQU
string indicate ; temp 0-byte filename to indicate if this ppe is used
string desclines(5) ; quick description used when it's a private upload
boolean doprivate ; flag indicating if upload is private or not
int numspaces ; number of spaces between commands
string noP, noH ; unhighlighted & highlighted text for "No"
string yesP, yesH ; unhighlighted & highlighted text for "Yes"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main body of program
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
begin
string tmpstr ; and foo to you too
Initialize()
CheckIndicate()
CheckAttach()
ShowRules()
; ask if the upload is a private upload
;
doprivate = AskYesNo(readline(equ_cfg, 8))
if (doprivate == TRUE) then
; ask for a filename and description
tmpstr = DoPrivateUpload()
else
; if it's not a private upload, then create a dummy filename
tmpstr = GenerateDummyFilename()
endif
IndicateBlindUpload()
StuffKeyboard(tmpstr)
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure DoPrivateUpload()
;
; handles if the user wants to send his upload privately to the sysop(s)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function DoPrivateUpload() string
string filename
filename = GetFilename()
newline
GetDescription()
newline
if (AskYesNo(readline(equ_cfg, 9)) == FALSE) then
; if we're here, user has selected "No" when asked if the description
; they've entered for the private upload is OK or not. if not, then
; delete the indicate file
;
newline
println readline(equ_cfg, 13)
startdisp FCL
if (exist(indicate)) then
delete indicate
endif
kbdstuff chr(13)
end
else
SendMessage(filename)
endif
DoPrivateUpload = filename
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure SendMessage()
;
; actually sends the message
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure SendMessage(string filename)
string msg, subj
int i
msg = ppepath() + "EQU" + string(pcbnode()) + ".MSG"
if (exist(msg)) then
delete msg
endif
fopen 1, msg, O_WR, S_DN
fputln 1, "Private upload from " + u_name() + " : " + filename
fputln 1, ""
for i = 1 to 5
if (desclines(i-1) != "") then
fputln 1, desclines(i-1)
endif
next i
fputln 1, ""
fputln 1, "@X08Posted via EQU v1.1 by Drew [PWA]@X07"
fputln 1, ""
fclose 1
newline
print readline(equ_cfg, 10)
subj = readline(equ_cfg, 16)
message 0, "SYSOP", u_name(), subj, "R", 0, FALSE, FALSE, msg
println readline(equ_cfg, 11)
newline
delete msg
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure GetDescription()
;
; Gets the "brief" description that the user is supposed to say. This
; description gets sent as a private message to the sysop.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure GetDescription()
int i
newline
println readline(equ_cfg, 12)
newline
for i = 1 to 5
print replacestr(readline(equ_cfg, 15), "%FN%", string(i))
inputstr "_", desclines(i-1), @X07, 70, MASK_ASCII() + MASK_ALNUM(), \
AUTO + DEFS + NEWLINE
if ((i==1) && (desclines(i-1) == "")) then
; user has hit RETURN on the first line of the description,
; therefore, aborting the procedure.
println readline(equ_cfg, 13)
newline
startdisp FCL
kbdstuff chr(13)
if (exist(indicate)) then
delete indicate
endif
end
elseif (desclines(i-1) == "") then
break
endif
next i
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; function GetFilename() string
;
; asks the user for the filename of the private upload to sysop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function GetFilename() string
string tmpstr
newline
print readline(equ_cfg, 14)
inputstr "_", tmpstr, @X07, 12, MASK_FILE(), AUTO + DEFS + FIELDLEN + GUIDE
if (tmpstr == "") then
; if we're here, user has hit RETURN w/o entering a filename for the
; private upload, so abort the entire procedure and delete the
; indicate file
newline
println readline(equ_cfg, 13)
newline
startdisp FCL
kbdstuff chr(13)
if (exist(indicate)) then
delete indicate
endif
end
else
GetFilename = tmpstr
endif
endfunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure ShowRules()
;
; duh
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure ShowRules()
string rules
int level
if (exist(ppepath() + "EQU.PCB")) then
dispfile ppepath() + "EQU.PCB", DEFS
endif
rules = readline(equ_cfg, 1)
if (exist(rules)) then
if (u_sec >= s2i(readline(equ_cfg, 2), 10)) then
dispfile rules, DEFS
endif
endif
startdisp FNS
newline
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure IndicateBlindUpload()
;
; since we're replacing several prompts instead of the "U" and "UB" commands,
; we need to make some sort of indication (a "marker") so that the next time
; this ppe comes up, it knows that it has been run already. thus, we just
; create zero-byte file, and end up deleting it when we're done.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure IndicateBlindUpload()
newline
fcreate 1, indicate, O_WR, S_DN
fclose 1
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure StuffKeyboard(string filename)
;
; stuffs the keyboard appropriately with a filename and description
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure StuffKeyboard(string filename)
string stuff
if (doprivate == TRUE) then
stuff = filename + chr(13) + \
"/ *** PRIVATE FILE(S) FOR THE SYSOP! ***" + chr(13) + \
"/ Blind upload; FILE_ID.DIZ will be used." + chr(13) + \
"/ Enhanced Quick Upload v1.1 by Drew [PWA]" + chr(13)
else
stuff = filename + chr(13) + \
"Blind upload; FILE_ID.DIZ will be used." + chr(13) + \
"Enhanced Quick Upload v1.1 by Drew [PWA]" + chr(13)
endif
kbdstuff stuff + chr(13)
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; function GenerateDummyFilename() string
;
; generates a dummy filename. this particular method is the same method used
; in the original MA-BAT20 by Mooncrow.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function GenerateDummyFilename() string
int i
string tmpstr
tmpstr = ""
for i = 1 to 8
tmpstr = tmpstr + string(random(9))
next i
tmpstr = tmpstr + ".ZIP"
GenerateDummyFilename = tmpstr
endfunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; function AskYesNo(string pr_string) boolean
;
; asks the user "Yes" or "No" in a lightbar fashion. returns TRUE if yes,
; FALSE if no.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
function AskYesNo(string pr_string) boolean
string ascii
int col1, col2
int curcmd
boolean quit
print pr_string
col1 = getx()
print noP + space(numspaces)
col2 = getx()
print yesP
curcmd = 1
PrintSelected(curcmd, col1, col2)
quit = FALSE
while (quit == FALSE) do
ascii = asc(inkey())
select case (ascii)
case 13
quit = TRUE
case 76, 68, 44
; left & down arrow or comma
dec curcmd
if (curcmd < 1) curcmd = 2
PrintSelected(curcmd, col1, col2)
case 82, 85, 46
; right & up arrow or period
inc curcmd
if (curcmd > 2) curcmd = 1
PrintSelected(curcmd, col1, col2)
case 89, 121
; upper Y and lower y
curcmd = 2
PrintSelected(curcmd, col1, col2)
quit = TRUE
case 78, 110
; upper N and lower n
curcmd = 1
PrintSelected(curcmd, col1, col2)
quit = TRUE
endselect
endwhile
newline
if (curcmd == 1) then
AskYesNo = FALSE
else
AskYesNo = TRUE
endif
endfunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure PrintSelected(...)
;
; prints the highlighted "Yes" or "No"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure PrintSelected(int curcmd, int col1, int col2)
if (curcmd == 2) then
print chr(13)
forward col1 - 1
print noP
print chr(13)
forward col2 - 1
print yesH
elseif (curcmd == 1) then
print chr(13)
forward col2 - 1
print yesP
print chr(13)
forward col1 - 1
print noH
endif
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure CheckIndicate()
;
; check if the indicate file exists or not. if it is, then that means
; an invocation to this ppe has been made, so we delete the file and
; and keyboard stuff a carriage return. this file is used so that we
; can figure out when we need to prompt the user. we only prompt the
; the user on the first time they hit UPLOAD and the "Enter the filename
; to upload" prompt comes up.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure CheckIndicate()
string foo
indicate = ppepath() + "EQUTMP." + string(pcbnode())
if (exist(indicate)) then
delete indicate
kbdstuff chr(13)
end
endif
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; procedure CheckAttach()
;
; check if we are doing a file attachment or not. there is kind of a
; "reverse" logic here, in that if the "ATTACH.###" file exists, that means
; we ** not ** doing a file attachment. that file is created by the u.ppe
; ub.ppe replacement ppe's to indicate we're doing a regular uploading
; process and not a file attachment (the reason why we need to do this is
; because the prompt "Enter Filename to Upload" is used in both places).
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure CheckAttach()
string tmpbuf
tmpbuf = ppepath() + "ATTACH." + string(pcbnode())
if (exist(tmpbuf)) then
delete tmpbuf
else
tmpbuf = ""
print readline(equ_cfg, 17)
inputstr "_", tmpbuf, @X07, 12, MASK_FILE(), DEFS + NEWLINE
kbdstuff tmpbuf + chr(13)
end
endif
endproc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; duh
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
procedure Initialize()
getuser
equ_cfg = ppepath() + "EQU.CFG"
numspaces = s2i(readline(equ_cfg, 3), 10)
noP = readline(equ_cfg, 4)
noH = readline(equ_cfg, 5)
yesP = readline(equ_cfg, 6)
yesH = readline(equ_cfg, 7)
fclose -1
endproc